home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / Amos / browser / Manual < prev    next >
Text File  |  1998-06-24  |  12KB  |  315 lines

  1.  
  2.                            The Amos Browser
  3.                   Copyright 1995-7 by Steven Goodwin
  4.  
  5.  
  6.                             -- Abstract --
  7.  
  8. This program is a useful tool  for  the Amos, or Amos Pro, programmer.
  9. The browser creates  a  database  of  your  program  that  knows every
  10. variable, procedure and label you've used.  It also knows where it was
  11. used, how often, where the  procedures  were  called from and when the
  12. variables  are  changed.  This  helps  code  management  as  it  shows
  13. redundant  code  and  variables,  where   globals  are  being  changed
  14. (possibly corrupted) and what code  can  be optimised. This program is
  15. intended to work  regardless  of  what  extensions  are  used, and how
  16. complex the code is.
  17.  
  18.    It extends beyond the usual  facilities  provided by search, as the
  19. browser will differentiate between 'Print', 'Int' and variables called
  20. 'RIN', ignore text in quotes  or  segments  of code hiding in comments
  21. and distinguish between local, global  and  shared variables using the
  22. same name! It also know  the  difference between strings, arrays, real
  23. and integer variables!
  24.  
  25.  
  26.                           -- Menu Options --
  27.  
  28. Project:
  29.  
  30. Open ASCII
  31.  
  32.    This loads  your  AMOS  program  into  the  browser  and  creates a
  33. database for it. A sample is  included.  The  source input file to the
  34. browser must be:
  35.  
  36. 1. Saved in plain  ASCII  format,  from  within  the  Amos editor. You
  37. should 'select all' and 'save ascii' from within AMOS.
  38.  
  39. 2. Completely open. i.e.  all  closed  procedures  must be opened from
  40. within AMOS using 'Open All'. If  the procedures in question have been
  41. 'locked', then simply  delete  the  'Procedure _CLOSED_PROC_NAME' from
  42. the file with a text editor,  and  replace it with a dummy 'Procedure-
  43. End Proc' pair.  This  is  not  essential,  but  it maintains accuracy
  44. within the parser (see Important Information below).
  45.  
  46. 3. A fully legal  program.  i.e.  the  'Test'  (F2) option returns 'No
  47. Errors'. The browser relies on  the  spacing and case-sensitive nature
  48. of  the  source  in  the  Amos  editor.  Changing  it  may  result  in
  49. inaccuracies! If you program using an  external editor you should load
  50. the source into the AMOS editor, and re-save.
  51.  
  52.    Once loaded, the browser will  scan  your  program, and create its'
  53. own internal tables. This process can  take  a long time. Often two or
  54. three times longer than it does to  'Test' it through AMOS. One reason
  55. is that the source must be scanned  in ASCII mode. AMOS tests it using
  56. a tokenised form, which  is  much  quicked,  due its compacted nature.
  57. (another reason is that Amos scans in assembler...I don't!).
  58.  
  59.  
  60. Open Browser
  61.  
  62.    This loads a '.browse' file into memory, and refreshs each window.
  63.  
  64. Save Browser
  65.  
  66.    This saves a '.browse' file  of  the current browse database. Using
  67. this file saves a lot of  time  over  importing an ASCII file, and re-
  68. calculating the database.
  69.  
  70. Quit
  71.  
  72.    Leaves the program!
  73.  
  74.  
  75.                              -- Window --
  76.  
  77. Variable Window:
  78.  
  79.    The left hand side lists  each  variable  used  in the program. The
  80. right hand side shows its definition  and  where it has been used (the
  81. references). The definition list is given thus,
  82.  
  83.    Definition:
  84.      Variable name (also known as the identifier)
  85.      Variable type (global string, int array, etc)
  86.  
  87.    References:
  88.      Line XX Procedure it appears in.  Proc_Line
  89.      ..etc..
  90.  
  91.  
  92. The 'XX' above consists of two special characters. The first character
  93. is either:
  94.  
  95. D   Declared - The variables first appearance in the source.
  96. S   Shared   - The variable is declared as shared for this procedure.
  97.                (note, this only appears on one line as all other
  98.                variables of this name within that procedure must, by
  99.                definition, be shared).
  100. -   Nothing special.
  101.  
  102.  
  103. The second character is either:
  104.  
  105. *   The variable is changed on this line. It may be through an
  106.     expression (A=B+4), or an instruction like Inc or Dec. If the
  107.     variable is an array, then changing any element in the array will
  108.     produce a '*'.
  109. :   Nothing special
  110.  
  111.  
  112.    The text requester  in  the  centre  of  the  window  allows you to
  113. restrict the variables listed in the list  on the left hand side. This
  114. is done by typing the  variable  name  into the requester and pressing
  115. 'Find'. This will then list the  variable  (if it exists), and (on the
  116. right hand side), its definition and references.
  117.  
  118.    To use wildcards on the variable name,  append  a '*' to the end of
  119. the name. This means  that  'ID_*'  (for  example)  will  list all the
  120. variables that start with 'ID_', and no others. Using '*' or '**' will
  121. list all the variables. A  trailing  wildcard character is, currently,
  122. the only acceptable variation (ie. VAR_*_SIZE will not work).
  123.  
  124.    The other option in this window  is  a  set of check boxes labelled
  125. 'Include?'. These options  specify  what  types  of  variable  will be
  126. included in the search initiated with  the 'Find' button. One point to
  127. bear in mind; if the variable is  a  string array, it will be included
  128. as both a string, AND an array,  so  you will have un-tick each box to
  129. exclude it from the search.
  130.  
  131.    To list all the variables  in  the  left  hand side scroll box just
  132. press 'Find Variable' with an empty text requester. This does the same
  133. as a search for '*' or '**' (i.e. a search for everything).
  134.  
  135.  
  136. Procedure Window:
  137.  
  138. This functions in the same manner  as  the 'variable window', it shows
  139. each procedure and where it  is  called  from.  The right hand window,
  140. however, has three possible  display  methodologies, selected from the
  141. radio buttons. They are:
  142.  
  143. References      Shows the procedure name, the line it is declared on,
  144.                 and each reference that calls the procedure.
  145.  
  146. Call Graph      Shows, in a graphical manner, each procedure and what
  147.                 subsequent procedures it calls. By starting with the
  148.                 main Amos program, it might show:
  149.  
  150.                         Main Amos Program
  151.                         +--INIT
  152.                         |  +--SETUP_BANKS
  153.                         |  +--LOAD_ICONS
  154.                         +--OPEN_MAIN_WINDOW
  155.                         +--EVENT_LOOP
  156.                         |  +--EMULATE
  157.                         |  +--HANDLE_EVENT
  158.                         |  |  +--HANDLE_MAIN
  159.                         |  |  +--HANDLE_PREFS
  160.                         |  +--NAGWARE_WINDOW
  161.                         +--CLOSE_ALL_WINDOWS
  162.                         +--QUIT
  163.  
  164. Caller Graph    Much the same as the call graph, this shows the
  165.                 "is called by" procedures. So, if your CLEAR_SCREEN
  166.                 procedure is being called too often, this graph will
  167.                 show you which routines can call it.
  168.  
  169.                 Because it is not possible for a procedure to re-run
  170.                 the program (only the Amos editor can do this) the
  171.                 list will be empty in this case.
  172.  
  173. Note: In the current  version,  the  order  of  procedure calls is not
  174. supported, so they may appear in the reverse order of a call graph, or
  175. caller graph list.
  176.  
  177.  
  178. Labels Window:
  179.  
  180. This window works in the same way  as both the variables and procedure
  181. windows. However, this only has 'Find  Label' function. Again, the '*'
  182. wildcard may only be placed at the end of the label identifier.
  183.  
  184.  
  185. Preferences Window:
  186.  
  187. This allows you to set the maximum number of variables, procedures and
  188. labels held  internally.  The  browser  must  be  restarted  for these
  189. options  to  take  effect.   This   information   is   stored  in  the
  190. configuration file which is saved  in  s:  and loaded into memory upon
  191. program boot-up.
  192.  
  193.  
  194.  
  195.                         -- IMPORTANT NOTES --
  196.  
  197. The main processing routine inside  the  browser is the 'parser'. This
  198. reads through the program file  looking  for variables, procedures and
  199. labels (refered to as identifiers).  However,  when coding this, I had
  200. no access to the actual syntax  rules,  or  the tokenised file form of
  201. AMOS. This meant I  had  to  'reverse-engineer'  my  own rules for the
  202. language. Although I have  tested  a  great  deal  of code through the
  203. parser, I may not have  catered  for  certain  'tricks' or cases which
  204. seem 'obvious' to some programmers. In  which case you may get strange
  205. variables appearing in the browse tables...but it should not be fatal.
  206. Furthermore, the  browser  should  work  through  most  (if  not  all)
  207. extensions.
  208.  
  209.    Here are some of the more 'exotic' uses of the Amos parser that the
  210. browser WILL cope with:
  211.  
  212. _CLEAR[SCR=Screen]
  213. _$=""
  214. Data NAME$,ADDRESS$,AGE
  215. LAB: PRC_NOT_LAB : PRC_NOT_LAB
  216.  
  217.  
  218. In order to improve the parser  speed,  some liberties were taken. The
  219. most obvious of these is the lack of error checking! If the program is
  220. not correct, or it runs out of  space to hold all the identifiers then
  221. it  will  stop,  and  the  program  will  exit  without  warning.  The
  222. registered version includes  a  'safe'  version  that  will  not exit,
  223. should any of the tables become full.
  224.  
  225.  
  226. All identifiers are significant to 32 characters.
  227.  
  228.  
  229. When loaded, the browser immediately  creates  space for the variable,
  230. procedure and label  tables.  If  it  suceeds,  the  only other memory
  231. required will be for the ASCII  program. Therefore, if the program can
  232. start, there should be no  memory allocation problems during execution
  233. (saving a browser file also  uses  allocated  memory, but it should be
  234. less than that of the ASCII program - which is currently removed after
  235. parsing - so if the  Amiga  managed  to  allocate  memory for that, it
  236. should be able to do so again).
  237.  
  238.  
  239.  
  240.                     -- Known Bugs and Omissions --
  241.  
  242.  
  243. Functions (in the form, Def Fn(x)  etc)  are  not handled. The code is
  244. parsed, although if it deals with  any  variables they will not appear
  245. correct in the list.
  246.  
  247. When running the browser as an  Amos  Pro accessory (only available to
  248. registered users), using key  shortcuts  inside  the browser can cause
  249. the keys to echo within the Amos Pro editor. They will be visible upon
  250. exit. If present, they will appear at the end of your source code.
  251.  
  252.  
  253.                          -- The Final Word --
  254.  
  255. This program is shareware, you can  use  it for 30 days without paying
  256. for it. If, however, you  want  the  source  (enabling  you to run the
  257. browser as an accessory from within Amos Pro!), or you wish to use the
  258. software after this period, then  send  me  £5,  and I'll return you a
  259. disc with all the source, the  latest version, and any other utilities
  260. I've written that haven't been released yet.
  261.  
  262. Now,
  263.  
  264. Q. Where do I send my money?
  265. A. Steven Goodwin
  266.    105 St. Johns Road
  267.    Clacton-on-Sea
  268.    Essex CO16 8DB
  269.  
  270. Q. What do I say?
  271. A. Try printing this off....
  272.    (or copying the relevant bits if you're without a printer)
  273.  
  274. o/_________________________ CUT HERE ________________________________
  275. O\
  276.  
  277. Your Name:_______________
  278. Address  :_______________
  279.           _______________
  280.           _______________
  281.           _______________
  282.  
  283. Hi Mr. Steven Goodwin,
  284.  
  285.    I would like to register my copy of The AMOS Browser because
  286.  
  287. a) It's brilliant!  (a very good reason, I might add)
  288. b) I think I'd prefer the 'safe' version, despite the performance hit.
  289. c) I'd like to run it as an accessory!
  290. d) I need access to the  preferences  because  my programs are too big
  291. and powerful!
  292. e) I have a tremendous guilt complex!
  293. f) All of the above                         (circle as appropriate)
  294.  
  295.    I enclose a cheque/postal order for £5 (which includes P&P) because
  296. I'm a kind hearted  soul  whos  cares  about  the  people  you make my
  297. software.
  298.  
  299.    Thanks very much,
  300.  
  301.  
  302.       Name ________________ (not completely necessary, but ties up the
  303.                              letter nicely)
  304.  
  305.  
  306. o/_________________________ CUT HERE ________________________________
  307. O\
  308.  
  309.  
  310. That's all folks!!!! See you on the next release...
  311.  
  312.  
  313.  
  314.  
  315.